package org.j2se.learn;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

/**
 * User: 缪凯
 * Date: 12-2-8
 * Time: 上午10:34
 */
public class UniformResource {
    public URL uriToUrl(URI uri){
        URL url = null;
        try {
            url = uri.toURL();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        return url;
    }


    public static void main(String[] args){
        UniformResource ur = new UniformResource();
        try {
            URL l = ur.uriToUrl(new URI("/org/j2se/learn/url.go"));
            System.out.println(l);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }
}
